package core.model;

import javax.persistence.Entity;
import javax.persistence.Table;

import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.crypto.password.StandardPasswordEncoder;

import commons.model.BaseEntity;


/**
 * Entity to hold application user data
 * @author giandefi
 *
 */
@Entity
@Table(name="appuser")
public class UserEntity extends BaseEntity {
        private static final long serialVersionUID = -8789920463809744548L;

        private String firstName;
        private String lastName;
        private String userName;
        private String password;
        private String email;
       
        public String getFirstName() {
                return firstName;
        }
       
        public void setFirstName(String firstName) {
                this.firstName = firstName;
        }
       
        public String getLastName() {
                return lastName;
        }
       
        public void setLastName(String lastName) {
                this.lastName = lastName;
        }
       
        public String getUserName() {
                return userName;
        }
       
        public void setUserName(String userName) {
                this.userName = userName;
        }
       
        public String getPassword() {
                return password;
        }
       
    	public void setPassword(String password) {
    		PasswordEncoder crypto = new StandardPasswordEncoder();
    		this.password = crypto.encode(password);
    	}

		public String getEmail() {
			return email;
		}

		public void setEmail(String email) {
			this.email = email;
		}
       
}


	
